package com.atguigu.exam;

/**
 * @author xbd
 * @create 2021-05-26 21:22
 */
public class ReflectColorTest {
    public static void main(String[] args) {
        ReflectColor r1 = ReflectColor.RED;
        System.out.println(r1);
        r1.meaning();
        r1.ReflectColor();
        System.out.println("**************");
        ReflectColor[] rs = ReflectColor.values();
        for (int i = 0; i < rs.length; i++) {
            System.out.println(rs[i]);
            rs[i].meaning();
            rs[i].ReflectColor();
        }
    }
}
interface Works{
    void ReflectColor();
}
interface showmessage{
    void meaning();
}
enum ReflectColor implements showmessage,Works{
    RED(255,0,0){
        @Override
        public void ReflectColor() {
            System.out.println("反射红色！");
        }

        @Override
        public void meaning() {
            System.out.println("红色");
        }


    },
    BLUE(0,0,255){
        @Override
        public void ReflectColor() {
            System.out.println("反射蓝色！");
        }

        @Override
        public void meaning() {
            System.out.println("蓝色");
        }
    },
    BLACK(0,0,0){
        @Override
        public void meaning() {
            System.out.println("黑色");
        }
        @Override
        public void ReflectColor() {
            System.out.println("反射黑色！");
        }
    },
    YELLOW(255,255,0){
        @Override
        public void meaning() {
            System.out.println("黄色");
        }
        @Override
        public void ReflectColor() {
            System.out.println("反射黄色！");
        }
    },
    GREEN(0,255,0){
        @Override
        public void meaning() {
            System.out.println("绿色");
        }
        @Override
        public void ReflectColor() {
            System.out.println("反射绿色！");
        }
    };

    private final int redValue;
    private final int greenValue;
    private final int blueValue;

    private ReflectColor(int redValue,int greenValue,int blueValue){
        this.redValue = redValue;
        this.greenValue = greenValue;
        this.blueValue = blueValue;
    }
    @Override
    public String toString() {
        return "Color{" +
                "redValue=" + redValue +
                ", greenValue=" + greenValue +
                ", blueValue=" + blueValue +
                '}';
    }
}
